import request from '../utils/request'
import type { ApiResponse, User, Prize, DrawResult } from './types'

export const userApi = {
  // 提交用户信息
  submit(user: User) {
    return request.post<ApiResponse<User>>('/api/lottery/user/submit', user)
  }
}

export const prizeApi = {
  // 获取奖品列表
  getList() {
    return request.get<ApiResponse<Prize[]>>('/api/lottery/prize/list', {
      params: { current: 1, size: 9999 }
    })
  }
}

export const lotteryApi = {
  // 执行抽奖
  draw(phone: string) {
    return request.post<ApiResponse<DrawResult>>('/api/lottery/record/draw', null, {
      params: { phone }
    })
  }
} 